package xby.study.noxmlweb;

import xby.study.noxmlweb.servlet.dynamic.DynamicServlet;

import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import java.util.Set;

public class ApplicationServletContainerInitializer implements ServletContainerInitializer {
    @Override
    public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException {

        //配置DynamicServlet
        DynamicServlet servlet = new DynamicServlet();
        ServletRegistration.Dynamic dispatcherServlet = ctx.addServlet("DynamicServlet", servlet);
        //启动级别
        dispatcherServlet.setLoadOnStartup(1);
        dispatcherServlet.addMapping("/dynamic");

    }
}
